]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st_theme_node_copy_cached_paint_state: allow self-assignment
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 15 Nov 2012 15:07:33 +0000 (15:07 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 15 Nov 2012 17:07:42 +0000 (17:07 +0000)
If you copy a theme node's paint state into itself, it should be an
inexpensive no-op. What actually happened was that we destroyed the
old paint state, re-initialized to blank, then copied the blank state
back into itself. In the process, we lost (for instance) the textures
for rounded corners.

Until I introduced the texture cache, this never actually happened,
because when st_widget_recompute_style() calls st_widget_get_theme_node(),
we'd always get a fresh theme node. Now, we get a theme node T back
from the cache, notice that paint_equal(T, T) is true, short-circuit
slightly by copying its drawing state into itself, and destroy drawing
state that we still needed.

I'm going to fix this in recompute_style() too, but as a general
principle, self-assignment ought to be harmless.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687465
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
src/st/st-theme-node-drawing.c

index c3424f9fd516ba725f7a57c280a363673fe7eb3e..429cc53b30e7090f08ca50622242364a098c5f30 100644 (file)
@@ -2060,6 +2060,9 @@ st_theme_node_copy_cached_paint_state (StThemeNode *node,
   g_return_if_fail (ST_IS_THEME_NODE (node));
   g_return_if_fail (ST_IS_THEME_NODE (other));
 
+  if (node == other)
+    return;
+
   /* Check omitted for speed: */
   /* g_return_if_fail (st_theme_node_paint_equal (node, other)); */